{% extends 'layout.html' %}
{% from 'macro/page.html' import render_pagination %}
{% from 'bootstrap/form.html' import render_form %}

{% block main %}
<div class="card">
    <div class="card-header">
        <h3 class="card-title">
            <a class="btn btn-info btn-sm" href="{{ url_for('admins.article_create') }}">发布文章</a>
        </h3>
        <div class="card-tools">
            <style>
                #search #title{
                    width:380px
                }
            </style>
            {{ render_form(form, form_type='inline',method='get',id="search") }}
        </div>
    </div>
    <!-- /.card-header -->
    <div class="card-body table-responsive p-0" style="height: 580px;">
        <table class="table table-hover table-head-fixed">
            <thead>
            <tr>
                <th>标题</th>
                <th>所属栏目</th>
                <th>发布时间</th>
                <th>作者</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for item in record.items %}
            <tr>
                <td>
                    {% if item.thumbnail %}<font style="color:red">[缩略图]</font>{% endif %}
                    {% if item.top %}<font style="color:red">[头条]</font>{% endif %}
                    {% if item.good %}<font style="color:red">[推荐]</font>{% endif %}
                    {% if item.focus %}<font style="color:red">[焦点图]</font>{% endif %}
                    <a class="no-pjax" href="{{ item.url }}" target="_blank">{{ item.title }}</a>
                </td>
                
                <td>{{ item.category.title }}</td>
                <td>{{ item.create_datetime }}</td>
                <td>{{ item.author }}</td>
                <td{%- if not item.status %} style="color: red;"{%- endif -%}>{{ item.status_text }}</td>
                <td>
                    <a class="btn btn-info btn-sm no-pjax"
                       href="{{ url_for('admins.article_modify', article_id=item.id, next=request.full_path) }}">编辑</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <!-- /.card-body -->
    <div class="card-footer clearfix">
        <!--        <button class="btn btn-info btn-sm un-pjax" href="/admins/article/create">百度提交</button>-->
        {{ render_pagination(record, size='sm', align='right') }}
    </div>
</div>
{% endblock %}